package com.lagou.service.impl;

import com.lagou.dao.ResumeDao;
import com.lagou.pojo.Resume;
import com.lagou.service.IResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class ResumeServiceImpl implements IResumeService {
    @Autowired
    private ResumeDao resumeDao;
    public Resume findById(Long id) {
        Optional<Resume> byId = resumeDao.findById(id);
        return byId.get();
    }

    @Override
    public List<Resume> findAll() {
        return resumeDao.findAll();
    }

    @Override
    public void update(Resume resume) {
        resumeDao.saveAndFlush(resume);
    }

    @Override
    public void delete(Long id){
        resumeDao.deleteById(id);
    }
}
